package Result;

import java.util.ArrayList;

public class MetaResultListsClass {
	
    ArrayList<ResultClassListClass> resultsListForCOOfTheDatasetsGeneratedWithTheSameParameters;
    ArrayList<ResultClassListClass> resultsListForLOOfTheDatasetsGeneratedWithTheSameParameters;
    ArrayList<ResultClassListClass> resultsListForICAOfTheDatasetsGeneratedWithTheSameParameters;
    
    ArrayList<ResultClassListClass> resultsListForAVEOfTheDatasetsGeneratedWithTheSameParameters;
    ArrayList<ResultClassListClass> resultsListForMAXOfTheDatasetsGeneratedWithTheSameParameters;
    ArrayList<ResultClassListClass> resultsListForPRDOfTheDatasetsGeneratedWithTheSameParameters;
    ArrayList<ResultClassListClass> resultsListForwAVEOfTheDatasetsGeneratedWithTheSameParameters;
    ArrayList<ResultClassListClass> resultsListForCNwAVEOfTheDatasetsGeneratedWithTheSameParameters;
    ArrayList<ResultClassListClass> resultsListForbAVEOfTheDatasetsGeneratedWithTheSameParameters;
    ArrayList<ResultClassListClass> resultsListForlaMAXOfTheDatasetsGeneratedWithTheSameParameters;
    ArrayList<ResultClassListClass> resultsListForlbMAXOfTheDatasetsGeneratedWithTheSameParameters;

	
	public MetaResultListsClass()
	{
		resultsListForCOOfTheDatasetsGeneratedWithTheSameParameters = new ArrayList<ResultClassListClass>(); 
    	resultsListForLOOfTheDatasetsGeneratedWithTheSameParameters = new ArrayList<ResultClassListClass>();
    	resultsListForICAOfTheDatasetsGeneratedWithTheSameParameters = new ArrayList<ResultClassListClass>();
    	
    	resultsListForAVEOfTheDatasetsGeneratedWithTheSameParameters = new ArrayList<ResultClassListClass>();
    	resultsListForMAXOfTheDatasetsGeneratedWithTheSameParameters = new ArrayList<ResultClassListClass>();
    	resultsListForPRDOfTheDatasetsGeneratedWithTheSameParameters = new ArrayList<ResultClassListClass>();
    	resultsListForwAVEOfTheDatasetsGeneratedWithTheSameParameters = new ArrayList<ResultClassListClass>();
    	resultsListForCNwAVEOfTheDatasetsGeneratedWithTheSameParameters = new ArrayList<ResultClassListClass>();
    	resultsListForbAVEOfTheDatasetsGeneratedWithTheSameParameters = new ArrayList<ResultClassListClass>();
    	resultsListForlaMAXOfTheDatasetsGeneratedWithTheSameParameters = new ArrayList<ResultClassListClass>();
    	resultsListForlbMAXOfTheDatasetsGeneratedWithTheSameParameters = new ArrayList<ResultClassListClass>();    	
	}
	
	public ArrayList<ResultClassListClass> getResultsListForCOOfTheDatasetsGeneratedWithTheSameParameters()
	{
		return resultsListForCOOfTheDatasetsGeneratedWithTheSameParameters;
	}
	
	public ArrayList<ResultClassListClass> getResultsListForLOOfTheDatasetsGeneratedWithTheSameParameters()
	{
		return resultsListForLOOfTheDatasetsGeneratedWithTheSameParameters;
	}
	
	public ArrayList<ResultClassListClass> getResultsListForICAOfTheDatasetsGeneratedWithTheSameParameters()
	{
		return resultsListForICAOfTheDatasetsGeneratedWithTheSameParameters;
	}
	
	public ArrayList<ResultClassListClass> getResultsListForAVEOfTheDatasetsGeneratedWithTheSameParameters()
	{
		return resultsListForAVEOfTheDatasetsGeneratedWithTheSameParameters;
	}
	
	public ArrayList<ResultClassListClass> getResultsListForMAXOfTheDatasetsGeneratedWithTheSameParameters()
	{
		return resultsListForMAXOfTheDatasetsGeneratedWithTheSameParameters;
	}
	
	public ArrayList<ResultClassListClass> getResultsListForPRDOfTheDatasetsGeneratedWithTheSameParameters()
	{
		return resultsListForPRDOfTheDatasetsGeneratedWithTheSameParameters;
	}

	public ArrayList<ResultClassListClass> getResultsListForwAVEOfTheDatasetsGeneratedWithTheSameParameters()
	{
		return resultsListForwAVEOfTheDatasetsGeneratedWithTheSameParameters;
	}
	
	public ArrayList<ResultClassListClass> getResultsListForCNwAVEOfTheDatasetsGeneratedWithTheSameParameters()
	{
		return resultsListForCNwAVEOfTheDatasetsGeneratedWithTheSameParameters;
	}
	
	public ArrayList<ResultClassListClass> getResultsListForbAVEOfTheDatasetsGeneratedWithTheSameParameters()
	{
		return resultsListForbAVEOfTheDatasetsGeneratedWithTheSameParameters;
	}

	public ArrayList<ResultClassListClass> getResultsListForlaMAXOfTheDatasetsGeneratedWithTheSameParameters()
	{
		return resultsListForlaMAXOfTheDatasetsGeneratedWithTheSameParameters;
	}
	
	public ArrayList<ResultClassListClass> getResultsListForlbMAXOfTheDatasetsGeneratedWithTheSameParameters()
	{
		return resultsListForlbMAXOfTheDatasetsGeneratedWithTheSameParameters;
	}
	/************************************************************************/
	public double calculateAverageAccuracyObtainedForCO()
	{
		return calculateAverageAccuracyObtainedForX(resultsListForCOOfTheDatasetsGeneratedWithTheSameParameters);
	}
	
	public double calculateAverageAccuracyObtainedForLO()
	{
		return calculateAverageAccuracyObtainedForX(resultsListForLOOfTheDatasetsGeneratedWithTheSameParameters);
	}
	
	public double calculateAverageAccuracyObtainedForICA()
	{
		return calculateAverageAccuracyObtainedForX(resultsListForICAOfTheDatasetsGeneratedWithTheSameParameters);
	}
	
	public double calculateAverageAccuracyObtainedForAVE()
	{
		return calculateAverageAccuracyObtainedForX(resultsListForAVEOfTheDatasetsGeneratedWithTheSameParameters);
	}
	
	public double calculateAverageAccuracyObtainedForMAX()
	{
		return calculateAverageAccuracyObtainedForX(resultsListForMAXOfTheDatasetsGeneratedWithTheSameParameters);
	}

	public double calculateAverageAccuracyObtainedForPRD()
	{
		return calculateAverageAccuracyObtainedForX(resultsListForPRDOfTheDatasetsGeneratedWithTheSameParameters);
	}
	
	public double calculateAverageAccuracyObtainedForwAVE()
	{
		return calculateAverageAccuracyObtainedForX(resultsListForwAVEOfTheDatasetsGeneratedWithTheSameParameters);
	}

	public double calculateAverageAccuracyObtainedForCNwAVE()
	{
		return calculateAverageAccuracyObtainedForX(resultsListForCNwAVEOfTheDatasetsGeneratedWithTheSameParameters);
	}
	
	public double calculateAverageAccuracyObtainedForbAVE()
	{
		return calculateAverageAccuracyObtainedForX(resultsListForbAVEOfTheDatasetsGeneratedWithTheSameParameters);
	}
	
	public double calculateAverageAccuracyObtainedForlaMAX()
	{
		return calculateAverageAccuracyObtainedForX(resultsListForlaMAXOfTheDatasetsGeneratedWithTheSameParameters);
	}
	
	public double calculateAverageAccuracyObtainedForlbMAX()
	{
		return calculateAverageAccuracyObtainedForX(resultsListForlbMAXOfTheDatasetsGeneratedWithTheSameParameters);
	}
	/************************************************************************/
	public double findErrorBarOfAccuracyResultsForCO()
	{
		return findErrorBarOfAccuracyResultsForX(resultsListForCOOfTheDatasetsGeneratedWithTheSameParameters);
	}
	
	public double findErrorBarOfAccuracyResultsForLO()
	{
		return findErrorBarOfAccuracyResultsForX(resultsListForLOOfTheDatasetsGeneratedWithTheSameParameters);
	}
	
	public double findErrorBarOfAccuracyResultsForICA()
	{
		return findErrorBarOfAccuracyResultsForX(resultsListForICAOfTheDatasetsGeneratedWithTheSameParameters);
	}
	
	public double findErrorBarOfAccuracyResultsForAVE()
	{
		return findErrorBarOfAccuracyResultsForX(resultsListForAVEOfTheDatasetsGeneratedWithTheSameParameters);
	}

	public double findErrorBarOfAccuracyResultsForMAX()
	{
		return findErrorBarOfAccuracyResultsForX(resultsListForMAXOfTheDatasetsGeneratedWithTheSameParameters);
	}
	
	public double findErrorBarOfAccuracyResultsForPRD()
	{
		return findErrorBarOfAccuracyResultsForX(resultsListForPRDOfTheDatasetsGeneratedWithTheSameParameters);
	}
	
	public double findErrorBarOfAccuracyResultsForwAVE()
	{
		return findErrorBarOfAccuracyResultsForX(resultsListForwAVEOfTheDatasetsGeneratedWithTheSameParameters);
	}
	
	public double findErrorBarOfAccuracyResultsForCNwAVE()
	{
		return findErrorBarOfAccuracyResultsForX(resultsListForCNwAVEOfTheDatasetsGeneratedWithTheSameParameters);
	}
	
	public double findErrorBarOfAccuracyResultsForbAVE()
	{
		return findErrorBarOfAccuracyResultsForX(resultsListForbAVEOfTheDatasetsGeneratedWithTheSameParameters);
	}

	public double findErrorBarOfAccuracyResultsForlaMAX()
	{
		return findErrorBarOfAccuracyResultsForX(resultsListForlaMAXOfTheDatasetsGeneratedWithTheSameParameters);
	}
	
	public double findErrorBarOfAccuracyResultsForlbMAX()
	{
		return findErrorBarOfAccuracyResultsForX(resultsListForlbMAXOfTheDatasetsGeneratedWithTheSameParameters);
	}
	
	/************************************************************************/
	
	public double calculateAverageAccuracyObtainedForX(ArrayList<ResultClassListClass> resultsListForXTypeOfTheDatasetsGeneratedWithTheSameParameters)
	{
		double sum=0.0;
		int numberOfResultsInTheList=resultsListForXTypeOfTheDatasetsGeneratedWithTheSameParameters.size();
		
		System.out.println("numberOfResultsInTheListMETA:"+numberOfResultsInTheList);
		
		if(numberOfResultsInTheList==0)
		{
			System.out.println("ERROR: The list is free in calculateAverageAccuracyObtainedForX");
			System.exit(0);
		}
		
		for(int i=0; i<resultsListForXTypeOfTheDatasetsGeneratedWithTheSameParameters.size(); i++)
			sum+=resultsListForXTypeOfTheDatasetsGeneratedWithTheSameParameters.get(i).calculateAverageAccuracyObtained();		
		
		return sum/numberOfResultsInTheList;
	}
	
	/*****************************************************************
	* Function Name:	findErrorBar 
	* Aim:				find the error Bar  
	* Inputs:		 
	* Outputs:			*** 			
	* Data Structures: 	***
	* Algorithms: 		
	 * @throws Exception ***
	*****************************************************************/
	
	public double findErrorBarOfAccuracyResultsForX(ArrayList<ResultClassListClass> resultsListForXTypeOfTheDatasetsGeneratedWithTheSameParameters)
	{
		int numberOfResultsInTheList=resultsListForXTypeOfTheDatasetsGeneratedWithTheSameParameters.size();
		double[] accuracyList = new double[numberOfResultsInTheList] ;

		for(int i=0; i<numberOfResultsInTheList; i++)
			accuracyList[i] = resultsListForXTypeOfTheDatasetsGeneratedWithTheSameParameters.get(i).calculateAverageAccuracyObtained();		  

		return Utility.WorkerUtilityClass.findErrorBar(accuracyList);
	}
	
	public void clear()
	{
		resultsListForCOOfTheDatasetsGeneratedWithTheSameParameters.clear(); 
    	resultsListForLOOfTheDatasetsGeneratedWithTheSameParameters.clear();
    	resultsListForICAOfTheDatasetsGeneratedWithTheSameParameters.clear();
    	resultsListForAVEOfTheDatasetsGeneratedWithTheSameParameters.clear();
    	resultsListForMAXOfTheDatasetsGeneratedWithTheSameParameters.clear();
    	resultsListForPRDOfTheDatasetsGeneratedWithTheSameParameters.clear();
    	resultsListForwAVEOfTheDatasetsGeneratedWithTheSameParameters.clear();
    	resultsListForCNwAVEOfTheDatasetsGeneratedWithTheSameParameters.clear();
    	resultsListForbAVEOfTheDatasetsGeneratedWithTheSameParameters.clear();
    	resultsListForlaMAXOfTheDatasetsGeneratedWithTheSameParameters.clear();
    	resultsListForlbMAXOfTheDatasetsGeneratedWithTheSameParameters.clear();
    }
}
